﻿// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
const static int bufferLength = 2048;
bool copy_file(const string& src, const string& dst) {
	ifstream in(src, ios::in | ios::binary);
	fstream out(dst, ios::out | ios::binary | ios::trunc);
	if (!in && !out) {
		cout << "文件读写失败" << endl;
		return false;
	}
	char temp[bufferLength];
	//eof
	while (!in.eof()) {
		in.read(temp, bufferLength);
		//实际读取的文件大小
		streamsize count = in.gcount();
		out.write(temp, count);
	}
	out.close();
	in.close();
	return true;
}
int main()
{
	/*fstream fout("buffer.txt", ios::out);
	fout << "hello world" << endl;
	for (int index = 0; index < 10; ++index) {
		fout << index << endl;
	}
	fout.close();*/

	//写一个函数，复制一张图片  src  ->  dst
	//cout << copy_file("s29247343.jpg", "a.jpg") << endl;
	/*vector<string> vt;
	ifstream in("buffer.txt", ios::in);
	if (!in) {
		cout << "文件打开失败" << endl;
		return -1;
	}
	string line;
	while (getline(in, line)) {
		vt.push_back(line);
	}
	for (auto& w : vt) {
		cout << w << endl;
	}*/

	string s = "hello 123 world";
	istringstream istr;
	istr.str(s);
	string s1, s2;
	int num;
	/*istr >> s1 >> num >> s2;
	cout << s1 << num << s2;*/

	vector<string> vt = { "abc", "def", "gh" };
	ostringstream ostr;
	for (auto& w : vt) {
		ostr << w << " ";
	}
	cout << ostr.str() << endl;



}


